<%-- 
    Document   : ViewAllGroups
    Created on : Dec 9, 2009, 1:08:25 AM
    Author     : zhi
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="Service.*, javabeans.*, java.util.*"%>
<%!
    List<GroupPlan> groupPlanList;
    GroupPlan gp1, gp2, gp3, gp4, gp5;
    int maxColumn = 5;

%>
<%
    String userid = request.getParameter("userid");
    GroupPlanService gps = new GroupPlanServiceImpl();
    groupPlanList = gps.viewAllGroupPlan();
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>All Group Plans</title>

        <link rel="Stylesheet" type="text/css" href="./extjs3.0/resources/css/ext-all.css"/>
        <script type="text/javascript" src="./extjs3.0/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="./extjs3.0/ext-all-debug.js"></script>

        <link rel="stylesheet" type="text/css" href="./css/view-all-group.css" />
        <script type="text/javascript" src="./js/view-all-groupplan.js"></script>
        <script type="text/javascript">
            var userid = '<%= request.getParameter("userid")%>';
        </script>
    </head>

<body>
<table width="1000" height="1045" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1000" height="473" colspan="2"><img src="image/viewallgroupplan/top.gif" width="1000" height="473"></td>
  </tr>
  <tr width="1000" height="471">
    <td width="282" height="471" valign="top"><img src="image/viewallgroupplan/left.gif" width="282" height="471"></td>
    <td width="728" height="471" align="left" valign="top">
	<form name="form1" method="post" action="">
            <div id="calendrier">
              <table width="674" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td class="head" width="91" height="28" >&nbsp;</td>
                          <td class="head" width="21" height="28" >&nbsp;</td>
                  <td class="head" width="245" height="28"><img src="image/viewallgroupplan/description.gif" width="77" height="18" align="middle"></td>
                          <td class="head" width="22" height="28">&nbsp;</td>
                  <td class="head" width="245" height="28"><img src="image/viewallgroupplan/members.gif" width="64" height="18"></td>
                  <td class="join" width="50">&nbsp;</td>
                </tr>
                <%
                    GroupPlan groupplan;
                    List<Member> memberList;
                    for(int i=0;i<groupPlanList.size();i++) {
                        if(i==maxColumn) break;
                        groupplan = groupPlanList.get(i);
                        memberList = groupplan.getGroupmembers();
                %>
                        <tr>
                          <td width="91" height="91" align="center" background="image/viewallgroupplan/circle.gif" style="color:#737373; font-family: verdanna; font-size: 13px;"><%= groupplan.getGroupplanname()%></td>
                          <td>&nbsp;</td>
                          <td class="content2" align="center"><%=groupplan.getPlandescript()%></td>
                          <td>&nbsp;</td>
                          <td class="content2">
                              <%
                                for(int j=0;j<memberList.size();j++) {
                                    Member member = memberList.get(j);
                                    if(member!=null)
                                        out.println(member.getEmail()+"<br/>");
                                }
                              %>
                          </td>
                          <td class="join"><img src="image/viewallgroupplan/join.gif" width="40" height="19" onClick="joinGroupPlan(userid,'<%=groupplan.getGroupplanid()%>')" style="cursor:pointer"></td>
                        </tr>
                        <tr>
                          <td height="7" colspan="5"><img src="image/viewallgroupplan/line.gif" width="624" height="5"></td>
                          <td>&nbsp;</td>
                        </tr>
                <%
                    }
                %>
                
                <tr>
                  <td class="page" height="15" colspan="5" align="center" style="color:#737373; font-family: verdanna; font-size: 13px;"><img src="image/viewallgroupplan/prev.gif" width="39" height="18"> 1 2 3 <img src="image/viewallgroupplan/next.gif" width="40" height="18"></td>
                  <td height="15"></td>
                </tr>

              </table>
             </div>
        </form>
    </td>
  </tr>
  <tr>
    <td colspan="2"><img src="image/viewallgroupplan/bottom.gif" width="1000" height="100"></td>
  </tr>
</table>
</body>
</html>
